<?php

namespace app\rider\controller;

use app\rider\services\OrderService;

class Order extends \app\BaseController
{
    protected $middleware=['CheckRiderTokenMiddleware'];

    /**
     * 订单详情
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function detail(){
        $p=$this->request->get();
        $p['shop_id']=$this->request->shopId;
        OrderService::detail($p);
    }

    /**
     * 拒绝订单，非新增订单（status==1）不可取消
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function refuse(){
        $p=$this->request->post();
        $p['admin_id']=$this->request->adminUid;
        OrderService::refuse($p);
    }

    public function list(){
        $p=$this->request->get();
        $p['admin_id']=$this->request->adminUid;
        $p['shop_id']=$this->request->shopId;
        OrderService::list($p);

    }

    public function accept(){
        $p=$this->request->post();
        $p['admin_id']=$this->request->adminUid;
        OrderService::accept($p);

    }

    public function finish(){
        $p=$this->request->post();
        $p['admin_id']=$this->request->adminUid;
        OrderService::finish($p);

    }
}
